home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic 5 Developer's Kit / vb5 dev kit.iso / dev / ipworks / ftp.fr_ / ftp.fr (.txt)
Encoding:
Visual Basic Form  |  1996-03-13  |  14.0 KB  |  447 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "FTP DEMO"
  5.    ClientHeight    =   4350
  6.    ClientLeft      =   1200
  7.    ClientTop       =   1365
  8.    ClientWidth     =   6195
  9.    Height          =   4755
  10.    Left            =   1140
  11.    LinkTopic       =   "Form1"
  12.    ScaleHeight     =   4350
  13.    ScaleWidth      =   6195
  14.    Top             =   1020
  15.    Width           =   6315
  16.    Begin TextBox tRemotefile 
  17.       FontBold        =   0   'False
  18.       FontItalic      =   0   'False
  19.       FontName        =   "MS Sans Serif"
  20.       FontSize        =   8.25
  21.       FontStrikethru  =   0   'False
  22.       FontUnderline   =   0   'False
  23.       Height          =   285
  24.       Left            =   4080
  25.       TabIndex        =   5
  26.       Top             =   1440
  27.       Width           =   2055
  28.    End
  29.    Begin CommandButton Command5 
  30.       Caption         =   "Logoff"
  31.       FontBold        =   0   'False
  32.       FontItalic      =   0   'False
  33.       FontName        =   "MS Sans Serif"
  34.       FontSize        =   8.25
  35.       FontStrikethru  =   0   'False
  36.       FontUnderline   =   0   'False
  37.       Height          =   255
  38.       Left            =   4440
  39.       TabIndex        =   20
  40.       Top             =   120
  41.       Width           =   855
  42.    End
  43.    Begin CommandButton Command4 
  44.       Caption         =   "Logon"
  45.       FontBold        =   0   'False
  46.       FontItalic      =   0   'False
  47.       FontName        =   "MS Sans Serif"
  48.       FontSize        =   8.25
  49.       FontStrikethru  =   0   'False
  50.       FontUnderline   =   0   'False
  51.       Height          =   255
  52.       Left            =   3480
  53.       TabIndex        =   19
  54.       Top             =   120
  55.       Width           =   855
  56.    End
  57.    Begin CommandButton Command3 
  58.       Caption         =   "Change Directory"
  59.       FontBold        =   0   'False
  60.       FontItalic      =   0   'False
  61.       FontName        =   "MS Sans Serif"
  62.       FontSize        =   8.25
  63.       FontStrikethru  =   0   'False
  64.       FontUnderline   =   0   'False
  65.       Height          =   255
  66.       Left            =   120
  67.       TabIndex        =   18
  68.       Top             =   1800
  69.       Width           =   1695
  70.    End
  71.    Begin CommandButton Command2 
  72.       Caption         =   "Download File"
  73.       FontBold        =   0   'False
  74.       FontItalic      =   0   'False
  75.       FontName        =   "MS Sans Serif"
  76.       FontSize        =   8.25
  77.       FontStrikethru  =   0   'False
  78.       FontUnderline   =   0   'False
  79.       Height          =   255
  80.       Left            =   120
  81.       TabIndex        =   17
  82.       Top             =   2160
  83.       Width           =   1695
  84.    End
  85.    Begin CommandButton Command1 
  86.       Caption         =   "Upload File"
  87.       FontBold        =   0   'False
  88.       FontItalic      =   0   'False
  89.       FontName        =   "MS Sans Serif"
  90.       FontSize        =   8.25
  91.       FontStrikethru  =   0   'False
  92.       FontUnderline   =   0   'False
  93.       Height          =   255
  94.       Left            =   120
  95.       TabIndex        =   16
  96.       Top             =   2460
  97.       Width           =   1695
  98.    End
  99.    Begin Frame Frame1 
  100.       BackColor       =   &H00C0C0C0&
  101.       Caption         =   "Tranfer Mode"
  102.       FontBold        =   0   'False
  103.       FontItalic      =   0   'False
  104.       FontName        =   "MS Sans Serif"
  105.       FontSize        =   8.25
  106.       FontStrikethru  =   0   'False
  107.       FontUnderline   =   0   'False
  108.       Height          =   1335
  109.       Left            =   120
  110.       TabIndex        =   12
  111.       Top             =   2880
  112.       Width           =   1695
  113.       Begin OptionButton optTransferMode 
  114.          BackColor       =   &H00C0C0C0&
  115.          Caption         =   "Binary"
  116.          FontBold        =   0   'False
  117.          FontItalic      =   0   'False
  118.          FontName        =   "MS Sans Serif"
  119.          FontSize        =   8.25
  120.          FontStrikethru  =   0   'False
  121.          FontUnderline   =   0   'False
  122.          Height          =   255
  123.          Index           =   2
  124.          Left            =   240
  125.          TabIndex        =   15
  126.          Top             =   840
  127.          Width           =   855
  128.       End
  129.       Begin OptionButton optTransferMode 
  130.          BackColor       =   &H00C0C0C0&
  131.          Caption         =   "ASCII"
  132.          FontBold        =   0   'False
  133.          FontItalic      =   0   'False
  134.          FontName        =   "MS Sans Serif"
  135.          FontSize        =   8.25
  136.          FontStrikethru  =   0   'False
  137.          FontUnderline   =   0   'False
  138.          Height          =   255
  139.          Index           =   1
  140.          Left            =   240
  141.          TabIndex        =   14
  142.          Top             =   540
  143.          Width           =   855
  144.       End
  145.       Begin OptionButton optTransferMode 
  146.          BackColor       =   &H00C0C0C0&
  147.          Caption         =   "Default"
  148.          FontBold        =   0   'False
  149.          FontItalic      =   0   'False
  150.          FontName        =   "MS Sans Serif"
  151.          FontSize        =   8.25
  152.          FontStrikethru  =   0   'False
  153.          FontUnderline   =   0   'False
  154.          Height          =   255
  155.          Index           =   0
  156.          Left            =   240
  157.          TabIndex        =   13
  158.          Top             =   240
  159.          Value           =   -1  'True
  160.          Width           =   855
  161.       End
  162.    End
  163.    Begin TextBox tRemotePath 
  164.       FontBold        =   0   'False
  165.       FontItalic      =   0   'False
  166.       FontName        =   "MS Sans Serif"
  167.       FontSize        =   8.25
  168.       FontStrikethru  =   0   'False
  169.       FontUnderline   =   0   'False
  170.       Height          =   285
  171.       Left            =   1920
  172.       TabIndex        =   4
  173.       Top             =   1440
  174.       Width           =   2055
  175.    End
  176.    Begin TextBox tLocalFile 
  177.       FontBold        =   0   'False
  178.       FontItalic      =   0   'False
  179.       FontName        =   "MS Sans Serif"
  180.       FontSize        =   8.25
  181.       FontStrikethru  =   0   'False
  182.       FontUnderline   =   0   'False
  183.       Height          =   285
  184.       Left            =   120
  185.       TabIndex        =   3
  186.       Text            =   "c:\testftp.1"
  187.       Top             =   1440
  188.       Width           =   1695
  189.    End
  190.    Begin FTP FTP1 
  191.       AltFile         =   ""
  192.       Height          =   420
  193.       Left            =   5520
  194.       LocalFile       =   ""
  195.       Password        =   ""
  196.       RegHandle       =   FTP.FRX:0000
  197.       RemoteFile      =   ""
  198.       RemoteHost      =   ""
  199.       RemotePath      =   ""
  200.       Top             =   120
  201.       TransferMode    =   0  'Default
  202.       User            =   ""
  203.       Width           =   420
  204.       WinsockLoaded   =   0   'False
  205.    End
  206.    Begin ListBox lFiles 
  207.       BackColor       =   &H00FFFFFF&
  208.       FontBold        =   0   'False
  209.       FontItalic      =   0   'False
  210.       FontName        =   "Courier New"
  211.       FontSize        =   8.25
  212.       FontStrikethru  =   0   'False
  213.       FontUnderline   =   0   'False
  214.       Height          =   2550
  215.       Left            =   1920
  216.       TabIndex        =   9
  217.       Top             =   1800
  218.       Width           =   4215
  219.    End
  220.    Begin TextBox tFTPServer 
  221.       FontBold        =   0   'False
  222.       FontItalic      =   0   'False
  223.       FontName        =   "MS Sans Serif"
  224.       FontSize        =   8.25
  225.       FontStrikethru  =   0   'False
  226.       FontUnderline   =   0   'False
  227.       Height          =   285
  228.       Left            =   1080
  229.       TabIndex        =   0
  230.       Top             =   120
  231.       Width           =   2295
  232.    End
  233.    Begin TextBox tUser 
  234.       FontBold        =   0   'False
  235.       FontItalic      =   0   'False
  236.       FontName        =   "MS Sans Serif"
  237.       FontSize        =   8.25
  238.       FontStrikethru  =   0   'False
  239.       FontUnderline   =   0   'False
  240.       Height          =   285
  241.       Left            =   1080
  242.       TabIndex        =   1
  243.       Top             =   480
  244.       Width           =   1335
  245.    End
  246.    Begin TextBox tPassword 
  247.       FontBold        =   0   'False
  248.       FontItalic      =   0   'False
  249.       FontName        =   "MS Sans Serif"
  250.       FontSize        =   8.25
  251.       FontStrikethru  =   0   'False
  252.       FontUnderline   =   0   'False
  253.       Height          =   285
  254.       Left            =   3360
  255.       PasswordChar    =   "*"
  256.       TabIndex        =   2
  257.       Top             =   480
  258.       Width           =   1335
  259.    End
  260.    Begin Label lPITrail 
  261.       BackStyle       =   0  'Transparent
  262.       BorderStyle     =   1  'Fixed Single
  263.       FontBold        =   0   'False
  264.       FontItalic      =   0   'False
  265.       FontName        =   "MS Sans Serif"
  266.       FontSize        =   8.25
  267.       FontStrikethru  =   0   'False
  268.       FontUnderline   =   0   'False
  269.       Height          =   255
  270.       Left            =   120
  271.       TabIndex        =   22
  272.       Top             =   840
  273.       Width           =   6015
  274.    End
  275.    Begin Label Label1 
  276.       BackStyle       =   0  'Transparent
  277.       Caption         =   "Remote File:"
  278.       FontBold        =   0   'False
  279.       FontItalic      =   0   'False
  280.       FontName        =   "MS Sans Serif"
  281.       FontSize        =   8.25
  282.       FontStrikethru  =   0   'False
  283.       FontUnderline   =   0   'False
  284.       Height          =   255
  285.       Index           =   5
  286.       Left            =   4080
  287.       TabIndex        =   21
  288.       Top             =   1200
  289.       Width           =   1095
  290.    End
  291.    Begin Label Label1 
  292.       BackStyle       =   0  'Transparent
  293.       Caption         =   "Remote Path:"
  294.       FontBold        =   0   'False
  295.       FontItalic      =   0   'False
  296.       FontName        =   "MS Sans Serif"
  297.       FontSize        =   8.25
  298.       FontStrikethru  =   0   'False
  299.       FontUnderline   =   0   'False
  300.       Height          =   255
  301.       Index           =   4
  302.       Left            =   1920
  303.       TabIndex        =   11
  304.       Top             =   1200
  305.       Width           =   1095
  306.    End
  307.    Begin Label Label1 
  308.       BackStyle       =   0  'Transparent
  309.       Caption         =   "Local File:"
  310.       FontBold        =   0   'False
  311.       FontItalic      =   0   'False
  312.       FontName        =   "MS Sans Serif"
  313.       FontSize        =   8.25
  314.       FontStrikethru  =   0   'False
  315.       FontUnderline   =   0   'False
  316.       Height          =   255
  317.       Index           =   3
  318.       Left            =   120
  319.       TabIndex        =   10
  320.       Top             =   1200
  321.       Width           =   1095
  322.    End
  323.    Begin Label Label1 
  324.       BackStyle       =   0  'Transparent
  325.       Caption         =   "FTP Server:"
  326.       FontBold        =   0   'False
  327.       FontItalic      =   0   'False
  328.       FontName        =   "MS Sans Serif"
  329.       FontSize        =   8.25
  330.       FontStrikethru  =   0   'False
  331.       FontUnderline   =   0   'False
  332.       Height          =   255
  333.       Index           =   0
  334.       Left            =   120
  335.       TabIndex        =   8
  336.       Top             =   120
  337.       Width           =   1095
  338.    End
  339.    Begin Label Label1 
  340.       BackStyle       =   0  'Transparent
  341.       Caption         =   "User:"
  342.       FontBold        =   0   'False
  343.       FontItalic      =   0   'False
  344.       FontName        =   "MS Sans Serif"
  345.       FontSize        =   8.25
  346.       FontStrikethru  =   0   'False
  347.       FontUnderline   =   0   'False
  348.       Height          =   255
  349.       Index           =   1
  350.       Left            =   120
  351.       TabIndex        =   7
  352.       Top             =   540
  353.       Width           =   855
  354.    End
  355.    Begin Label Label1 
  356.       BackStyle       =   0  'Transparent
  357.       Caption         =   "Password:"
  358.       FontBold        =   0   'False
  359.       FontItalic      =   0   'False
  360.       FontName        =   "MS Sans Serif"
  361.       FontSize        =   8.25
  362.       FontStrikethru  =   0   'False
  363.       FontUnderline   =   0   'False
  364.       Height          =   255
  365.       Index           =   2
  366.       Left            =   2520
  367.       TabIndex        =   6
  368.       Top             =   540
  369.       Width           =   975
  370.    End
  371. Sub Command1_Click ()
  372. FTP1.LocalFile = tLocalFile
  373. FTP1.Action = 5 'Upload File
  374. End Sub
  375. Sub Command2_Click ()
  376. FTP1.LocalFile = tLocalFile
  377. FTP1.Action = 4 'Download File
  378. End Sub
  379. Sub Command3_Click ()
  380. 'change directory
  381. tRemotePath = tRemotePath & "/" & tRemoteFile
  382. FTP1.RemotePath = tRemotePath
  383. tRemotePath = FTP1.RemotePath
  384. lFiles.Clear
  385. tRemoteFile = ""
  386. FTP1.Action = 8 'list
  387. End Sub
  388. Sub Command4_Click ()
  389. On Error GoTo ErrorHandling
  390. FTP1.WinsockLoaded = True
  391. lFiles.Clear
  392. If tFTPServer = "" Then
  393.     MsgBox "Please supply a valid FTP server."
  394.     Exit Sub
  395. End If
  396. FTP1.RemoteHost = tFTPServer
  397. FTP1.User = tUser
  398. FTP1.Password = tPassword
  399. FTP1.Action = 2 'Logon
  400. tRemotePath = FTP1.RemotePath
  401. FTP1.Action = 8 'list
  402. Exit Sub
  403. ErrorHandling:
  404.     MsgBox Error$
  405.     Exit Sub
  406. End Sub
  407. Sub Command5_Click ()
  408. FTP1.Action = 3 'Logoff
  409. End Sub
  410. Sub Form_Resize ()
  411. If WindowState <> 1 Then
  412.     If ScaleWidth - tRemoteFile.Left > 31 Then
  413.         tRemoteFile.Width = ScaleWidth - tRemoteFile.Left - 30
  414.     End If
  415.     If ScaleWidth - lFiles.Left > 31 Then
  416.         lFiles.Width = ScaleWidth - lFiles.Left - 30
  417.     End If
  418.     If ScaleHeight - lFiles.Top > 31 Then
  419.         lFiles.Height = ScaleHeight - lFiles.Top - 30
  420.     End If
  421.     lPITrail.Width = ScaleWidth - lPITrail.Left - 30
  422. End If
  423. End Sub
  424. Sub FTP1_DirList (DirEntry As String)
  425. lFiles.AddItem DirEntry
  426. End Sub
  427. Sub FTP1_PITrail (Direction As Integer, Message As String)
  428. Select Case Direction
  429.     Case 0: lPITrail = "CLIENT: " & Message
  430.     Case 1: lPITrail = "SERVER: " & Message
  431.     Case 2: lPITrail = "INFO:   " & Message
  432. End Select
  433. Debug.Print Direction & ": " & Message
  434. End Sub
  435. Sub FTP1_Transfer (BytesTransferred As Long, Text As String)
  436. lPITrail = "TRANSFER: " & BytesTransferred & " bytes"
  437. End Sub
  438. Sub lFiles_Click ()
  439. tRemoteFile = lFiles.List(lFiles.ListIndex)
  440. End Sub
  441. Sub optTransferMode_Click (Index As Integer)
  442. FTP1.TransferMode = Index
  443. End Sub
  444. Sub tRemotefile_Change ()
  445. FTP1.RemoteFile = tRemoteFile
  446. End Sub
  447.